package Operations;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class Addbook implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("添加图书");
        System.out.println("输入你想添加的图书名");
        Scanner scanner =new Scanner(System.in);
        String name=scanner.nextLine();
        System.out.println("输入你想添加的图书的出版社");
        Scanner scanne =new Scanner(System.in);
        String publish=scanne.nextLine();
        System.out.println("输入你想添加的图书的作者");
        Scanner scann =new Scanner(System.in);
        String author=scann.nextLine();
        System.out.println("输入你想添加的图书的种类");
        Scanner scan =new Scanner(System.in);
        String kind=scan.nextLine();
        System.out.println("输入你想添加的图书的价格");
        Scanner sca =new Scanner(System.in);
        int price =scanne.nextInt();
        Book books =new Book(name,publish,author,kind,price,false);
        int curSize= bookList.getSize();
        bookList.Setbook(books,curSize);
        bookList.setSize(curSize+1);
        System.out.println("添加成功");
    }
}
